package com.ely.coupon.activity.validation;

import com.ely.coupon.activity.validation.constraint.CheckTypeValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 保存策略
 */
@Retention(RetentionPolicy.RUNTIME)
/**
 * 限制修饰的类型
 */
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
// validatedBy  指定自定义校验器
@Constraint(validatedBy = CheckTypeValidator.class)
public @interface CheckType {
    int[] value() default 0;

    String message() default "参数不合法";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
